package com.yupi.springbootinit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yupi.springbootinit.model.entity.NumberSequence;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;

/**
 * 流水号序列表 Mapper
 */
@Mapper
public interface NumberSequenceMapper extends BaseMapper<NumberSequence> {

    /**
     * 查询并锁定记录（用于并发安全的流水号生成）
     *
     * @param businessType 业务类型
     * @param date 日期
     * @return 流水号记录
     */
    NumberSequence selectForUpdate(@Param("businessType") String businessType,
                                   @Param("date") LocalDate date);
}